<template>
  <div v-if="modelValue" class="modal-bg" @click="$emit('update:modelValue', false)">
    <div class="fadeInLeft animated modal" @click="stopPropagation">
      <slot />
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps(["modelValue"]);
defineEmits(["update:modelValue"]);

function stopPropagation(e) {
  e.stopPropagation();
}
</script>

<style lang="scss" scoped>
.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1001;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 50%);

  .modal {
    width: 400px;
    height: 100%;
    background: #fff;
  }
}
</style>
